java_library(
  name = 'http',
  srcs = glob(['src/main/java/**/*.java']),
  provided_deps = ['//lib:servlet-api-3_1'],
  visibility = ['PUBLIC'],
)

TESTUTIL_SRCS = glob(['src/test/**/testutil/**/*.java'])

java_library(
  name = 'testutil',
  srcs = TESTUTIL_SRCS,
  deps = [
    '//gerrit-extension-api:api',
    '//lib:guava',
    '//lib:servlet-api-3_1',
    '//lib/httpcomponents:httpclient',
    '//lib/jgit/org.eclipse.jgit:jgit',
  ],
  visibility = ['PUBLIC'],
)

java_test(
  name = 'http_tests',
  srcs = glob(
    ['src/test/java/**/*.java'],
    excludes = TESTUTIL_SRCS,
  ),
  deps = [
    ':http',
    ':testutil',
    '//lib:junit',
    '//lib:servlet-api-3_1',
    '//lib:truth',
    '//lib/easymock:easymock',
  ],
  source_under_test = [':http'],
  # TODO(sop) Remove after Buck supports Eclipse
  visibility = ['//tools/eclipse:classpath'],
)
